<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>设备维修</title>
    <link rel="stylesheet" href="/lib/layui/layui/css/layui.css?20190817.1">
    <link rel="stylesheet" href="/lib/layui/layui/css/common.css">
    <script src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/global.js"></script>
    <script type="text/javascript" src="../../js/jquery/jquery-1.9.1.js"></script>
    <script src="../../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layui/layui/js/baseCode/base.js?v=201908121454" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layui/layui/js/common.js?v=201907231346" type="text/javascript" charset="utf-8"></script>
    <style>
        .layui-card-header{
            border-bottom: 1px solid #eee;
        }
        .mbox{
            padding: 8px;
        }
        .inbox{
            padding: 5px;
            padding-right: 30px;
        }
        .deptinput{
            display: inline-block;
            width: 75%;
        }
        .layui-btn{
            margin-left: 10px;
        }
        .layui-btn .layui-icon{
            margin-right: 0px;
        }
        .red{
            color: red;
            font-size: 16px;
        }
        .layui-form-label{
            padding: 8px 15px;
        }
        .layui-card-body{
            display: flex;
        }
        .layui-lf{
            min-width: 16%;
            overflow-x: auto;
            height: 600px !important;
        }
        .layui-rt{
            width: 84%;
            margin-left: 6px;
            margin-top: -11px;
        }
        .treeTitle{
            display: flex;
            box-sizing: border-box;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 30px;
            background-color: #00a0e9;
            color: #fff;
            padding: 15px;
            position: relative;
        }
        .layui-nav-item,.layadmin-flexible{
            position: absolute;
            left: 5px;
            top: 23px;
            z-index: 9999999;
        }
        .rtfix{
            width:200px;
            /*overflow-x: scroll;*/
        }
        .bg{
            background-color: #F2F2F2;
        }
        .bgs{
            background-color: #F2F2F2;
        }
        .back{
            background-color: #ccc;
        }
        .eleTree{
            cursor: pointer;
        }
        .layui-table-view .layui-table td, .layui-table-view .layui-table th{
            padding: 3px 0;
        }
        .layui-tab-title{
            height: 30px;
        }
        .layui-tab-title li{
            height: 36px;
            margin-top: -5px;
        }
        .layui-tab layui-tab-card{
            margin-top: -4px;
        }
        .layui-tab-card>.layui-tab-title .layui-this:after {
            border-width: 0px;
        }
        .baseinfo td{
            padding: 5px 2px;
        }
        .active{
            display: none;
        }
        .back{
            background-color: #F2F2F2;
        }
        .layui-tab-title li{
            margin-top: 0;
        }
        .select .layui-input{
            height: 28px;
        }
        /*---------------*/

        #memo{
            width:696px;
        }
        .inp{
            height: 33px;
            border:none
        }
        .taby{
            width:100%;
            min-height: 25px;
            line-height: 25px;
            text-align: center;
            border:1px solid #e6e6e6;
            border-collapse: collapse;
        }
        td{
            border:1px solid #e6e6e6;
            height: 40px;
            line-height: 40px;
        }
        th{
            border:1px solid #e6e6e6;
        }
        #experiencebase .layui-table{
            width: 100%!important;
        }
        .infomation{
            display: none;
        }
        textarea{
            border:none;
            line-height: 35px;
        }
        .seeFild{
            padding:5px 10px 0 0;
        }
    </style>
</head>
<body>

<div class="mbox">
    <div class="layui-card">
        <div class="layui-card-body" style="padding-left: 6px;">
            <%--&lt;%&ndash;左侧选择设备的下拉数-%>--%>
            <div class="layui-lf rtfix">
                <div class="treeTitle" id="equip" dataType="0" >设备类别
                </div>
                <div class="panel-body">
                    <div class="eleTree ele1" lay-filter="data1"></div>
                </div>
            </div>
            <%--右侧的tab页--%>
            <div class="layui-rt" style="position: relative">
                <div class="layui-tab layui-tab-card" lay-filter="docDemoTabBrief">
                    <ul class="layui-tab-title" style="height: 35px;">
                        <li class="layui-this">设备报修</li>
                        <li>执行维修</li>
                        <li>维修验证</li>
                        <li>维修记录</li>
                    </ul>
                    <%--很多选项--%>
                    <div class="layui-tab-content" style="padding: 2px 0" id="SettlementDiv">
                        <%--第一个tab--%>
                        <div class="layui-tab-item layui-show">
                            <table id="Settlement" lay-filter="SettlementFilter"></table>
                        </div>

                    </div>
                </div>
                <div class="layui-tab layui-tab-card">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基本信息</li>
                    </ul>
                    <div class="layui-tab-content"class="layui-form" style="padding: 2px">
                        <div class="layui-tab-item layui-show">
                            <table class="layui-table" lay-skin="line">
                                <colgroup>
                                    <col width="">
                                    <col width="">
                                    <col width="">
                                    <col>
                                </colgroup>
                                <thead>
                                <tr>
                                    <th colspan="5"style="padding: 6px 2px">设备信息</th>
                                </tr>
                                </thead>
                                <tbody class="baseinfo">
                                <tr>
                                    <td>固定资产编号：<sapn style="color: #111" id="equipNo" class="none"></sapn></td>
                                    <td>设备名称：<sapn style="color: #111" id="equipName"class="none"></sapn></td>
                                    <td>维修状态：<span style="color: #111" id="equipStatuasCode"class="none"></span></td>
                                    <td colspan="2">设备类型：<span style="color: #111" id="equipTypeName"class="none"></span></td>
                                </tr>
                                <tr>
                                    <td>现象分类：<span style="color: #111" id="equipStatuasId" class="none"></span></td>
                                    <td>型号：<span style="color: #111" id="modelNo"class="none"></span></td>
                                    <td>规格：<span style="color: #111" id="spec"class="none"></span></td>
                                    <td colspan="2">流水号：<span style="color: #111" id="workflowNo"class="none"></span></td>
                                </tr>
                                <tr>
                                    <td>报修人：<span style="color: #111" id="applicant" class="none"></span></td>
                                    <td>报修部门：<span style="color: #111" id="borrowerdeptName" class="none"></span></td>
                                    <td colspan="3">出厂编号：<span style="color: #111" id="factoryNo" class="none"></span></td>
                                </tr>
                                <tr>
                                    <td>发生部位：<span style="color: #111" class="none" id="faultPosition"></span></td>
                                    <td colspan="4">报修时间：<span style="color: #111"class="none" id="applicationTime"></span></td>
                                </tr>
                                <tr>
                                    <td colspan="5">故障描述：<textarea readonly class="faultDesc" name="faultDesc"  id="faultDesc"  cols="30" rows="10" style="height: 35px;width:90%;vertical-align:middle;resize:none;"></textarea></td>
                                </tr>
                                <tr>
                                    <td colspan="4" style="height: 50px">故障文件：<span style="color: #111" class="none" id="attachmentName"></span>
                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <th colspan="5"style="padding: 6px 2px;background-color: #f2f2f2;" class="infomation">故障信息</th>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <%--表格--%>
                        <div class="tables" style="display:none">
                            <table class="taby"><%----%>
                                <thead>
                                <tr style="  background-color: #f2f2f2;">
                                    <th style="width: 200px; height:40px; line-height:40px;" lay-data="{field:'username', width:200}"></th>
                                    <th lay-data="{field:'experience', width:400}">内部故障诊断&维修措施</th>
                                    <th lay-data="{field:'sign'}">外部故障诊断&维修措施</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>检测结果</td>
                                    <td><input type="text" value="" disabled name="inResult" class="layui-input inp inResult none" autocomplete="off"></td>
                                    <td><input type="text" value="" disabled name="outResult" class="layui-input inp outResult none" autocomplete="off"></td>
                                    <td><input type="hidden" value="" disabled  name="experId" class="layui-input inp experId none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>故障定位</td>
                                    <td><input type="text" value="" disabled   name="inFaultPosition" class="layui-input inp inFaultPosition none" autocomplete="off"></td>
                                    <td><input type="text" value="" disabled   name="outFaultPosition" class="layui-input inp outFaultPosition none" autocomplete="off"></td>

                                </tr>
                                <tr>
                                    <td>原因分析</td>
                                    <td><input type="text"value="" disabled   name="inReason" class="layui-input inp inReason none" autocomplete="off"></td>
                                    <td><input type="text"value="" disabled   name="outReason" class="layui-input inp outReason none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>维修措施</td>
                                    <td><input type="text" value="" disabled  name="inRepairMeasure" class="layui-input inp none" id="inRepairMeasure"autocomplete="off"></td>
                                    <td><input type="text" value="" disabled  name="outRepairMeasure" class="layui-input inp outRepairMeasure none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>维修方式</td><%--下拉框--%>
                                    <td>
                                        <input type="text" value="" disabled  name="inRepairMode" class="layui-input inp inRepairMode none" autocomplete="off">
                                    </td>
                                    <td><input type="text" value="" disabled  name="outRepairMode" class="layui-input inp outRepairMode none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>维修等级</td>
                                    <td>
                                        <input type="text"  value="" disabled  name="inRepairRank" class="layui-input inp inRepairRank none" id="Deng" autocomplete="off">
                                    </td>
                                    <td><input type="text" value="" disabled   name="outRepairRank" class="layui-input inp outRepairRank none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>维修预算</td>
                                    <td><input type="text" value="" disabled  name="inPrice" class="layui-input inp inPrice none" autocomplete="off"></td>
                                    <td><input type="text" value="" disabled  name="outPrice" class="layui-input inp outPrice none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>计划完成时间</td>
                                    <td><input type="text" value="" disabled  name="inPlanTime" class="layui-input inp inPlanTime none" autocomplete="off"></td>
                                    <td><input type="text" value="" disabled  name="outPlanTime" class="layui-input inp outPlanTime none" autocomplete="off"></td>
                                </tr>
                                <tr>
                                    <td>诊断人员</td>
                                    <td><input type="text" value="" disabled  name="inPerson" class="layui-input inp inPerson none" autocomplete="off"></td>
                                    <td><input type="text" value="" disabled  name="outPerson" class="layui-input inp outPerson none" autocomplete="off"></td>
                                </tr>
                                <tr  class="info" style="display:none">
                                    <th colspan="5"style="padding: 6px 4px;background-color: #f2f2f2;text-align: left;">验证结果</th>
                                </tr>
                                <tr class="info" style="display:none">
                                    <td colspan="5"><span style="margin-left: -3%">验证措施：</span><textarea name="verifyMeasure" readonly  class="verifyMeasure" cols="30" rows="10" style="height: 35px;width:90%;vertical-align:middle;resize:none;"></textarea></td>
                                </tr>
                                <tr  class="info" style="display:none">
                                    <td colspan="2" style="text-align: left;padding: 6px 4px;border-right: none">验证方式：<span style="color: #111" class="equipVerifyMode none"></span></td>
                                    <td colspan="3"   style="text-align: left;padding: 6px 4px;">验证结果：<span style="color: #111"  class="equipRepairResult none"></span></td>
                                </tr>
                                <tr  class="info" style="display:none">
                                    <td colspan="2" style="text-align: left;padding: 6px 4px;">维修完成日期：<span style="color: #111" class="reportDoneTime none"></span></td>
                                    <td colspan="3"  style="text-align: left;padding: 6px 4px;">验证人：<span style="color: #111"  class="verifyUser none"></span></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%--设备报修--%>
<script type="text/html" id="toolbar">
    <div class="demoTable indexOne" style="float: right; margin-right:9px;margin-top: -1px;">
        <label  class="layui-form-label" style="width: 86px">查询字段</label>
        <div class="layui-input-inline" style="height: 27px;margin-top: -11px;" >
            <select class="layui-select indexSeleOne"  lay-filter="cloum" name="cloum" id="cloum" autocomplete="off">
                <option value="">请选择</option>
                <option value="REPALOG_ID">记录编号</option>
                <option value="EQUIP_NAME">设备名称</option>
                <option value="EQUIP_TYPE_NAME">设备类型</option>
                <option value="FAULT_TYPE">现象分类</option>
                <option value="FAULT_POSITION">发生部位</option>
                <option value="FAULTDESC">故障描述</option>
                <option value="APPLICANT">报修人</option>
                <option value="WORTKFLOW_NO">流水号</option>
            </select>
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="indexOne"autocomplete="off" style="height: 38px">
        </div>
        <button class="layui-btn search" data-type="reload" style="height:30px;line-height: 30px">搜索</button>
    </div>
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add" style="width: 70px" id="addEq">新建</button>
        <button class="layui-btn layui-btn-sm" lay-event="psub" style="width: 70px">提交</button>
    </div>
</script>
<%--执行维修--%>
<script type="text/html" id="implement">
    <div class="demoTable indexOne" style="float: right; margin-right:9px;margin-top: -1px;">
        <label  class="layui-form-label" style="width: 86px">查询字段</label>
        <div class="layui-input-inline" style="height: 27px;margin-top: -11px;" >
            <select class="layui-select indexSeleOne"  lay-filter="cloum" name="cloum"  autocomplete="off">
                <option placeholder="请选择"></option>
                <option value="REPALOG_ID">记录编号</option>
                <option value="EQUIP_NAME">设备名称</option>
                <option value="EQUIP_TYPE_NAME">设备类型</option>
                <option value="FAULT_TYPE">现象分类</option>
                <option value="FAULT_POSITION">发生部位</option>
                <option value="APPLICANT">报修人</option>
                <option value="WORTKFLOW_NO">流水号</option>
            </select>
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="indexOne"  autocomplete="off" style="height: 38px">
        </div>
        <button class="layui-btn search" data-type="reload" style="height:30px;line-height: 30px">搜索</button>
    </div>
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="zxtj" style="width: 70px">提交</button>
    </div>
</script>
<%--验证维修--%>
<script type="text/html" id="vfmaintain">
    <div class="demoTable indexOne" style="float: right; margin-right:9px;margin-top: -1px;">
        <label  class="layui-form-label" style="width: 86px">查询字段</label>
        <div class="layui-input-inline" style="height: 27px;margin-top: -11px;" >
            <select class="layui-select indexSeleOne"  lay-filter="cloum" name="cloum"  autocomplete="off">
                <option placeholder="请选择"></option>
                <option value="REPALOG_ID">记录编号</option>
                <option value="EQUIP_NAME">设备名称</option>
                <option value="EQUIP_TYPE_NAME">设备类型</option>
                <option value="FAULT_TYPE">现象分类</option>
                <option value="FAULT_POSITION">发生部位</option>
                <option value="APPLICANT">报修人</option>
                <option value="WORTKFLOW_NO">流水号</option>
            </select>
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="indexOne"  autocomplete="off" style="height: 38px">
        </div>
        <button class="layui-btn search" data-type="reload" style="height:30px;line-height: 30px">搜索</button>
    </div>
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="wxtj" style="width: 70px">提交</button>
    </div>
</script>
<%--维修记录--%>
<script type="text/html" id="record">
    <div class="demoTable indexOne" style="float: right; margin-right:9px;margin-top: -1px;">
        <label  class="layui-form-label" style="width: 86px">查询字段</label>
        <div class="layui-input-inline" style="height: 27px;margin-top: -11px;" >
            <select class="layui-select indexSeleOne"  lay-filter="cloum" name="cloum"  autocomplete="off">
                <option placeholder="请选择"></option>
                <option value="REPALOG_ID">记录编号</option>
                <option value="EQUIP_NAME">设备名称</option>
                <option value="EQUIP_TYPE_NAME">设备类型</option>
                <option value="FAULT_TYPE">现象分类</option>
                <option value="FAULT_POSITION">发生部位</option>
                <option value="APPLICANT">报修人</option>
                <option value="WORTKFLOW_NO">流水号</option>
            </select>
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="indexOne" id="demoReloads" autocomplete="off" style="height: 38px">
        </div>
        <button class="layui-btn search" data-type="reload" style="height:30px;line-height: 30px">搜索</button>
    </div>
</script>

<%--设备报修--%>
<script type="text/html" id="barOperation">
    <a class="layui-btn layui-btn-xs" lay-event="edit" id="edit1">编辑</a>
    <a class="layui-btn layui-btn-sm layui-btn-xs" lay-event="sub" id="sub">提交</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" >删除</a>
</script>
<%--执行维修--%>
<script type="text/html" id="maintain">
    <a class="layui-btn layui-btn-xs" lay-event="zxwx">执行维修</a>
    <a class="layui-btn layui-btn-sm layui-btn-xs" lay-event="sub1">提交</a>
</script>
<%--维修验证--%>
<script type="text/html" id="Verification">
    <a class="layui-btn layui-btn-xs" lay-event="weixyz">维修验证</a>
    <a class="layui-btn layui-btn-sm layui-btn-xs" lay-event="sub2">提交</a>
</script>
<script type="text/javascript">
    var el
        ,aldata
        ,newstr='<div class="iptbox mnodec" pid="">'+
        '<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="序号" class="layui-input pnul">'+
        '<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="名称" class="layui-input shorts">'+
        '<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="备注" class="layui-input longs">'+
        '<div class="btnls">'+
        '<button type="button" class="layui-btn layui-btn-primary layui-btn-sm limsAdd"><i class="layui-icon"></i></button>'+
        '<button type="button" class="layui-btn layui-btn-primary layui-btn-sm limsDel"><i class="layui-icon"></i></button>'+
        '</div>'+
        '</div>';
    var resultTypeData='';
    var a ="";
    var name;
    var pid;
    var idkey;
    var tableObj;
    var  repalog
    var repalogId
    var trObj;
    var equipids;   //下拉数的id
    var attachIds;
    var equipStatus=1;//设备维修状态
    var selectName;//下拉框的值
    var selectVal;//搜索框的值
    var isTrue;//定义 表格是否有数据 true 有 false 无
    var displayDataInfo;
    layui.use(['table','layer','form','element','eleTree'], function() {
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var eleTree = layui.eleTree;
        var element = layui.element;
        var $ = layui.jquery;
        var url = '/equipment/deleteEquipment';
        //维修措施
        table.init('demo', {
            height: 315 //设置高度
            , limit: 10 //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
            //支持所有基础参数
        });
        // //监听复选框事件
        table.on('checkbox(SettlementFilter)', function (obj) {
            repalog = obj.data.repalogId
            var tr = obj.tr[0];
            if (obj.checked) {
                $(tr).addClass('bgs')
            } else {
                $(tr).removeClass('bgs').removeClass('bg')
            }
        });

        // 初始化渲染 树形菜单
        el = eleTree.render({
            elem: '.ele1',
            showLine: true,
            url: '/equipmentType/showParentEquipmentType',
            lazy: true,
            load: function (data, callback) {
                $.post('/equipmentType/showChildEquipmentType?equipTypeId=' + data.id, function (res) {
                    callback(res.data);//点击节点回调
                })

            },
            done: function (data) { //渲染完成回调
                aldata = data.data
                name = data.data[0].name //传的是默认选中的值
                pid = data.data[0].equipTypePid;
                getTabke(data.data[0].id);
                idkey = data.data[0].id;
                equipids = data.data[0].id;
                //给左侧的下拉数据点击时添加的背景颜色
                var dataid = $('.ele1 div').attr("data-id")
                $('.eleTree-node').removeClass('back')
                $('.ele1 div[data-id=' + dataid + ']').addClass('back')
                $('.eleTree-node-group').css('background', '#fff')
                var aa = $(".mbox").find(".ele1 .eleTree-node").eq(0).attr("data-id");
            }
        });

        // 节点点击事件
        eleTree.on("nodeClick(data1)", function (d) {
            var dataid = $('.ele1 div').attr("data-id")
            var a = d.data.currentData.id;
            $('.eleTree-node').removeClass('back')
            $(d.node[0]).addClass('back')
            $('.eleTree-node-group').css('background', '#fff')
            var obj = d.data.currentData
            name = obj.name
            pid = obj.equipTypePid;
            idkey = obj.id;
            $.post('/equipmentType/showEquipmentTypeById?equipTypeId=' + obj.id, function (res) {
                equipids = res.object.id    //节点点击下拉数的id
                console.log(equipids, 111)
                var obj = res.data
                    , str;
            })
            var currentPage = 1
            table.reload('Settlement', {
                url: '/equipment/selectAllReparlog?equipTypeId=' + obj.id,
                data: {page: currentPage},
                page: {
                    curr: currentPage
                }
            })

        });

        //监听头部事件
        table.on('toolbar(SettlementFilter)', function (res) {
            var checkStatus = table.checkStatus(res.config.id);
            switch (res.event) {
                case 'add':
                    if (pid == 0) {
                        layer.msg("一级类别下无法添加");
                        return false;
                    } else {
                        layer.open({
                            type: 2 //此处以iframe举例
                            , title: '添加'
                            , area: ['100%', '100%']
                            , maxmin: true
                            , content: '/equipment/addServicing?addbtn=add'
                            , btn: ['保存', '取消']
                            , yes: function (index, layero) {
                                var experience = window["layui-layer-iframe" + index].getRepairDate();
                                if (experience == undefined || experience == '' || experience == {}) {
                                    layer.msg('必填项不可为空')
                                } else {
                                    $.ajax({
                                        url: "/equipment/insertEquipReparlog",
                                        type: 'post',
                                        data: experience,
                                        success: function (res) {
                                            layer.msg(res.msg)
                                            tableObj.reload()
                                        }
                                    })
                                    layer.closeAll();
                                }
                            }
                        });
                    }
                    break;
                case 'psub':

                    if (checkStatus.data.length < 1) {
                        layer.msg('请至少选择一个')
                    } else if (checkStatus.data.length > 1) {
                        layer.msg('只能选一个')
                    } else if (checkStatus.data.length == 1) {
                        $.ajax({
                            url: '/equipment/updateByEquipReparlog?repairStatus=2',
                            type: 'get',
                            dataType: 'json',
                            data: {repalogId: checkStatus.data[0].repalogId},
                            success: function (res) {
                                tableObj.reload()
                                layer.msg('提交成功')
                            }
                        })
                    }
                    break;
                case 'zxtj':
                    if (checkStatus.data.length < 1) {
                        layer.msg('请至少选择一个')
                    } else if (checkStatus.data.length > 1) {
                        layer.msg('只能选一个')
                    } else if (checkStatus.data.length == 1) {
                        $.ajax({
                            url: '/equipment/updateByEquipReparlog?repairStatus=3',
                            type: 'get',
                            dataType: 'json',
                            data: {repalogId: checkStatus.data[0].repalogId},
                            success: function (res) {
                                tableObj.reload()
                                layer.msg('提交成功')
                            }
                        })
                    }
                    break;
                case 'wxtj':
                    if (checkStatus.data.length < 1) {
                        layer.msg('请至少选择一个')
                    } else if (checkStatus.data.length > 1) {
                        layer.msg('只能选一个')
                    } else if (checkStatus.data.length == 1) {
                        $.ajax({
                            url: '/equipment/updateByEquipReparlog?repairStatus=0',
                            type: 'get',
                            dataType: 'json',
                            data: {repalogId: checkStatus.data[0].repalogId},
                            success: function (res) {
                                tableObj.reload()
                                layer.msg('提交成功')
                            }
                        })
                    }
                    break;
            }
        });
// 编辑/删除操作
        table.on('tool(SettlementFilter)', function (obj) {//注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            trObj = data;
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            repalogId = data.repalogId
            if (layEvent === 'del') { //删除
                publicDeleteEval('/equipment/deleteLimsEquipReparlogById', data.repalogId, tableObj, table);
            }
            else if (layEvent === 'edit') { //编辑
                layer.open({
                    type: 2 //此处以iframe举例
                    , title: '编辑'
                    , area: ['100%', '100%']
                    , maxmin: true
                    , content: '/equipment/addServicing?editbtn=edit'
                    , btn: ['保存', '取消']
                    , yes: function (index, layero) {
                        var experience = window["layui-layer-iframe" + index].getRepairDate();
                        experience.repalogId = repalogId
                        $.ajax({
                            url: "/equipment/updateEquipReparlog",
                            type: 'post',
                            data: experience,
                            success: function (res) {
                                layer.msg('修改成功')
                                tableObj.reload()
                            }
                        })
                        layer.closeAll()
                    }
                });
            } else if (layEvent === 'sub') {
                $.ajax({
                    url: '/equipment/updateByEquipReparlog',
                    type: 'get',
                    dataType: 'json',
                    data: {repalogId: data.repalogId, repairStatus: 2},
                    success: function (res) {
                        tableObj.reload({
                            done:function(res){
                                if(res.data[0]==undefined||res.data[0]=='undefined'){
                                    var d = {}
                                    displayData(d)
                                }

                            }
                        })
                        layer.msg('提交成功')
                    }
                })
            } else if (layEvent === 'sub1') {
                $.ajax({
                    url: '/equipment/updateByEquipReparlog',
                    type: 'get',
                    dataType: 'json',
                    data: {repalogId: data.repalogId, repairStatus: 3},
                    success: function (res) {
                        tableObj.reload({
                            done:function(res){
                                if(res.data[0]==undefined||res.data[0]=='undefined'){
                                    var d = {}
                                    displayData(d)
                                }
                            }
                        })
                        layer.msg('提交成功')
                    }
                })
            } else if (layEvent === 'sub2') {
                $.ajax({
                    url: '/equipment/updateByEquipReparlog',
                    type: 'get',
                    dataType: 'json',
                    data: {repalogId: data.repalogId, repairStatus: 0},
                    success: function (res) {
                        tableObj.reload({
                            done:function(res){
                                if(res.data[0]==undefined||res.data[0]=='undefined'){
                                    var d = {}
                                    displayData(d)
                                }
                            }
                        })
                        layer.msg('提交成功')
                    }
                })
            }
            else if (layEvent === 'yzsub') {    //验证提交
                $.ajax({
                    url: '/equipment/updateByEquipReparlog?repairStatus=3',
                    type: 'get',
                    dataType: 'json',
                    data: {repalogId: repalog},
                    success: function (res) {
                        tableObj.reload()
                        layer.msg(res.msg)
                    }
                })
            } else if (layEvent === 'weixyz') {    //维修验证
                window.relogId = repalogId
                layer.open({
                    type: 2 //此处以iframe举例
                    , title: '维修验证'
                    , area: ['100%', '100%']
                    , maxmin: true
                    , content: '/equipment/verifquip?weixyzbtn=weixyz'
                    , btn: ['保存', '取消']
                    , yes: function (index, layero) {
                        var experience = window["layui-layer-iframe" + index].addDatas();
                        experience.repalogId = repalogId
                        $.ajax({
                            url: "/equipment/updateEquipReparlog",
                            type: 'post',
                            data: experience,
                            success: function (res) {
                                layer.msg(res.msg)
                                tableObj.reload()
                            }
                        })
                        layer.closeAll()
                    }
                })
            } else if (layEvent === 'zxwx') {  //执行维修
                window.relogId = repalogId
                layer.open({
                    type: 2 //此处以iframe举例
                    , title: '执行维修'
                    , area: ['100%', '100%']
                    , maxmin: true
                    , content: '/equipment/execution?zxwxbtn=zxwx'
                    , btn: ['保存', '取消']
                    , yes: function (index, layero) {
                        var experience = window["layui-layer-iframe" + index].addDatas();
                        experience.repalogId = repalogId
                        $.ajax({
                            url: "/equipment/updateEquipReparlog",
                            type: 'post',
                            data: experience,
                            success: function (res) {
                                layer.msg(res.msg)
                                tableObj.reload()
                            }
                        })
                        layer.closeAll()
                    }
                });
            }
        });

        //顶部页签切换事件
        element.on('tab(docDemoTabBrief)', function (data) {
            var index = data.index;
            switch (index) {
                case 0:
                    equipStatus = 1;
                    tableReload(1, "#barOperation", false, "#toolbar", "/equipment/selectAllReparlog");
                    $('.tables').hide()
                    break;
                case 1:
                    equipStatus = 2;
                    tableReload(2, "#maintain", false, "#implement", "/equipment/selectAllReparlog");
                    $('.tables').show();
                    $('.infomation').show()
                    $(".info").hide();
                    break;
                case 2:
                    equipStatus = 3;
                    tableReload(3, "#Verification", false, '#vfmaintain', "/equipment/selectAllReparlog");
                    $('.tables').show();
                    $('.infomation').show()
                    $('.info').show()
                    break;
                case 3:
                    equipStatus = '';
                    tableReload('', "", true, "#record", "/equipment/selectAllReparlog");
                    $('.tables').show();
                    $('.infomation').show()
                    $('.info').show()
                    break;
            }

        });
        //***************搜索功能**************
        $(document).on('click', '.search', function () {
            displayDataInfo = {}
            displayData(displayDataInfo);
            var sele = $('.indexSeleOne').val()
            var inpt = $("input[name='indexOne']").val()
            selectName = sele;
            selectVal = inpt;
            if(sele == ''&& inpt != ''){
                layer.msg('请选择查询字段')
            }else if (sele == '' && inpt == '') {
                tableObj.reload({
                    url: '/equipment/selectAllReparlog',
                    page: true
                    , where: {
                        "repairStatus": equipStatus,
                        "equipTypeId": idkey
                    }, done: function (res) {
                        // displayData(res);
                        $("#SettlementDiv tbody").find("tr").eq(0).click();
                    }
                })
            } else {
                tableObj.reload({
                    url: '/equipment/selectByEquipReparlogt',
                    page: true,
                    where: {
                        repairStatus: equipStatus,
                        FieldName: sele,
                        FieldValue: inpt
                    }
                    , done: function (res) {
                        $("input[name='indexOne']").val(selectVal);  //输入框
                        $(".indexSeleOne").each(function () {
                            // this代表的是<option></option>，对option再进行遍历
                            $(this).children("option").each(function () {
                                // 判断需要对那个选项进行回显
                                //
                                if (this.value == selectName) {
                                    // 进行回显
                                    $(this).attr("selected", "selected");
                                }
                            });
                        });
                        form.render('select');
                        $("#SettlementDiv tbody").find("tr").eq(0).click();
                    }
                })
            }
        })

        //回车实现搜索
        //下面方法兼容谷歌，火狐，ie:
        document.onkeydown = function (e) {
            var theEvent = window.event || e;
            var code = theEvent.keyCode || theEvent.which;
            if (code == 13) {
                $('.search').click();
            }
        };


        //监听表格行事件
        table.on('row(SettlementFilter)', function (obj) {
            var repalogId = obj.data.repalogId;
            var i = 0;
            a = obj.data.equipId;
            if (obj.data.dateProduc == undefined) {
                obj.data.dateProduc = nowformat();
            } else {
                obj.data.dateProduc = format(obj.data.dateProduc);
            }
            ;
            if (obj.data.recordDate == undefined) {
                obj.data.recordDate = nowformat();
            } else {
                obj.data.recordDate = format(obj.data.recordDate);
            }
            ;

            //选中行变颜色方法
            var index = $(this).attr('data-index');
            var tr = $(this).parent().children(tr);
            $(this).addClass("bg");
            for (var i = 0; i < tr.length; i++) {
                if (index != i) {
                    tr.eq(i).removeClass("bg");
                }
            }
                $.ajax({
                    url: "/equipment/selectByReparlog",
                    type: 'post',
                    data: {
                        repalogId: repalogId
                    },
                    success: function (res) {
                        if(res.data==undefined||res.data.length<0){
                            displayDataInfo ={}
                            displayData(displayDataInfo)
                        }else{
                            $("#attachmentName").empty()
                            var attach = ""
                            for (var i = 0; i < res.obj.limsEquipReparlogFiles.length; i++) {
                                var attId = res.obj.limsEquipReparlogFiles[i].attachmentId;
                                var attName = res.obj.limsEquipReparlogFiles[i].attachmentName;
                                if (attId != '' && attName != '' && attId != undefined && attName != undefined) {
                                    var attachIdArr = attId.split(',');
                                    var attachNameArr = attName.split(',');
                                    for (var j = 0; j < attachIdArr.length; j++) {

                                        var attachId = "\"" + attachIdArr[j] + "\"";
                                        var attachName = attachNameArr[j];
                                        if (attachId != '' && attachName != '') {

                                            attach += "<div style='padding: 10px 0 10px 0'><label class='seeFild'>附件名称</label><label>" + attachName + "</label><button type='button' class='layui-btn layui-btn-sm look' onclick='lookFile(" + attachId + ")'>查看</button><button type='button' class='layui-btn layui-btn-sm  layui-btn-danger downlode' onclick='downFile(" + attachId + ")'>下载</button></div>"
                                        }
                                    }
                                }

                            }
                            $("#attachmentName").append(attach)
                            var data = res.data[0];
                            displayData(data)
                        }

                    }
                })




        });
    })
        //将毫秒数转为yyyy-MM-dd格式时间
        function format(t) {
            var str = "";
            var nnow = new Date(t);
            var year = nnow.getFullYear();
            var month = nnow.getMonth() + 1;
            var day = nnow.getDate();
            str = year + "-" + month + "-" + day;
            return str;
        }

        //获取当前时间  年月日
        function nowformat() {
            var nstr = "";
            var now = new Date();
            var nyear = now.getFullYear();
            var nmonth = now.getMonth() + 1;
            var nday = now.getDate();
            if (nmonth < 10) {
                nmonth = "0" + nmonth;
            }
            if (nday < 10) {
                nday = "0" + nday;
            }
            nstr = nyear + "-" + nmonth + "-" + nday;
            return nstr;
        }

        $("#equip").click(function () {
            window.location.reload()
        })
        $('#fixed').click(function (e) {
            e.stopPropagation();
            $('table').width('100%')
            if ($(this).attr('dataType') != 1) {
                $('.layui-lf').fadeOut();
                $('.layui-rt').animate({width: '100%'});
                $(this).attr('dataType', '1');
            } else {
                $('.layui-lf').fadeIn();
                $('.layui-rt').animate({width: '84%'});
                $(this).attr('dataType', '0');
            }

        })

    //设备保修
    function getTabke(getid,colbtn) {

        displayDataInfo = {}
        displayData(displayDataInfo);
        tableObj=layui.table.render({
            elem: '#Settlement'
            ,url: '/equipment/selectAllReparlog?equipTypeId='+getid //数据接口
            ,where:{"repairStatus":1}
            ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['prev', 'page', 'next',  'skip','count','limit',]//自定义分页布局
                ,limits:[5,10,15,20,25,30,35,40,45,50]
                ,first: false //不显示首页
                ,last: false //不显示尾页
            } //开启分页
            ,toolbar:'#toolbar'
            ,cols: [[ //表头
                {type: 'checkbox' }
                ,{field: 'repalogId', title: '记录编号',width:90}
                ,{field: 'repairStatus', title: '维修状态',width:94,templet:function(d){
                        //console.log(d,"ddddd")
                        if(d.repairStatus=="1"){
                            return '报修中'
                        }else if(d.repairStatus=="2"){
                            return '维修中'
                        }else if(d.repairStatus=="3"){
                            return '验证中'
                        }else if(d.repairStatus=="0"){
                            return '已完成'
                        }
                    }
                }
                ,{field: 'equipName', minWidth:130,title: '设备名称'}
/*
                ,{field: 'equipNo', title: '固定资产编号',minWidth:168}
*/
                ,{field: 'equipTypeName', title: '设备类型'}
                ,{field: 'manufacturer', title: '规格',hide:true}
                ,{field: 'supplier', title: '型号',hide:true}
                ,{field: 'factoryNo', title: '出厂编号',hide:true}
                ,{field: 'faultType', title: '现象分类',templet:function (b) {
                        if(b.codeName!=undefined){
                            return b.codeName
                        }else {
                            return b.faultType
                        }
                    }
                }
                ,{field: 'faultPosition', title: '发生部位'}
                ,{field: 'faultDesc', title: '故障描述',hide:true}
                ,{field: 'applicant', title: '报修人'}
                ,{field: 'applicationTime', title: '报修时间',hide:true}
                ,{field: 'workflowNo', title: '流水号'}
                ,{width:200, title: '操作',align:'center', toolbar: '#barOperation'}
            ]]
            ,limit:5
            ,done:function(res) {
                if (res.data != undefined && res.data.length > 0) {
                    isTrue='true';
                    //displayData(res.data[0]);
                    $("#SettlementDiv tbody").find("tr").eq(0).click();
                    $.get('/equipmentCapys/selectByEquipId',{equipId:res.data[0].equipId},function (res) {
                        resultTypeData = res.data;
                        var str="";
                        for(var i=0;i<resultTypeData.length;i++){
                            str += '<tr>' +
                                '<td style="color: #111;">'+resultTypeData[i].capyName+'</td>' +
                                '<td idx="'+i+'" typename="capyInitialValue" class="edit" style="color: #111;">'+undefind_nullStr(resultTypeData[i].capyInitialValue)+'</td>' +
                                '<td idx="'+i+'" typename="calibrationValue"  class="edit" style="color: #111;">'+undefind_nullStr(resultTypeData[i].calibrationValue)+'</td>' +
                                '</tr>';
                        }
                        $(".total").html(str)
                        layui.form.render();
                    })
                } else {
                    isTrue='false';
                   //
                    displayDataInfo = {}
                    displayData(displayDataInfo);
                }


            }
        });
    };

    function settingClos1(table, operationId) {
        var operation = {fixed: 'right', hide: true, width: 250, title: '操作', align: 'center', toolbar: operationId}
        var tableArray = table;
        if (tableArray != undefined && tableArray != "") {
            // tableArray[0].push(operation);
        }
        return tableArray;
    }

    //给指定表格添加操作栏属性
    function settingClos(table, operationId) {
        var operation = {
            fixed: 'right',
            hide: false,
            width: 250,
            title: '操作',
            align: 'center',
            toolbar: operationId
        }
        var tableArray = table;
        if (tableArray != undefined && tableArray != "") {
            tableArray[0].push(operation);
        }
        return tableArray;
    }
    //维修表格重新加载函数
    function tableReload(param, clos,bool, toolbar, url) {
        tableObj.reload({
            elem: '#Settlement',
            where: {
                "repairStatus":param,
                "equipTypeId":idkey
            }
            , page: {
                curr: 1 //重新从第 1 页开始
            },
            url: url,
            toolbar: toolbar,
            cols:[[ //表头
                {type: 'checkbox' }
                ,{field: 'repalogId', title: '记录编号',width:90}
                ,{field: 'equipStatuasCode', title: '维修状态',width:94,templet:function(d){
                        if(d.repairStatus=="1"){
                            return '报修中'
                        }else if(d.repairStatus=="2"){
                            return '维修中'
                        }else if(d.repairStatus=="3"){
                            return '验证中'
                        }else if(d.repairStatus=="0"){
                            return '已完成'
                        }
                    }}
                ,{field: 'equipName', title: '设备名称',minWidth:130}
/*
                ,{field: 'equipNo', title: '固定资产编号',minWidth:168}
*/
                ,{field: 'equipTypeName', title: '设备类型'}
                ,{field: 'manufacturer', title: '规格',hide:true}
                ,{field: 'supplier', title: '型号',hide:true}
                ,{field: 'factoryNo', title: '出厂编号',hide:true}
                ,{field: 'codeName', title: '现象分类'}
                ,{field: 'faultPosition', title: '发生部位'}
                ,{field: 'faultDesc', title: '故障描述',hide:true}
                ,{field: 'applicant', title: '报修人'}
                ,{field: 'applicationTime', title: '报修时间',hide:true}
                ,{field: 'workflowNo', title: '流水号'}
                ,{width:180, hide:bool,title: '操作',align:'center', toolbar: clos}
            ]],
            done: function (res) {
                if (res.data != undefined && res.data.length > 0) {
                    //display(res.data[0]);
                    $("#SettlementDiv tbody").find("tr").eq(0).click();
                } else {
                    //
                    displayDataInfo = {}
                    displayData(displayDataInfo);
                }
            }
        })

    }
        function undefind_nullStr(value) {
            if(value==undefined){
                return ""
            }
            return value
        }
    function displayData(data){
        if(data==undefined || data=='undefined'||data.length<1||data.repalogId==undefined||data.repalogId==''){

            $('.none').html('');
            $('.none').val('');
            $("#faultDesc").text('')
            $(".verifyMeasure").text('')
            $(".total").addClass("active");
        }else{
            $('#equipNo').html(data.repalogId);
            $('#equipName').html(data.equipName);
            $('#equipStatuasId').html(undefind_nullStr(data.faultType));
            $('#equipTypeName').html((data.equipTypeName));
            $('#modelNo').html(data.modelNo);
            $('#faultPosition').html(data.faultPosition);
            $('#applicant').html(data.applicant);
            $('#workflowNo').html(data.workflowNo);
            //$('#positionId').html(data.positionId);
            $('#factoryNo').html(data.factoryNo);
            $('#propertyNo').html(undefind_nullStr(data.propertyNo));
            $('#deptName').html(data.deptName);
            $('#atmosphereTemp').html(data.atmosphereTemp)
            $('#atmosphereHumi').html(data.atmosphereHumi)
            $('#voltage').html(data.voltage)
            $('#resistance').html(data.resistance)
            $('#waterPressure').html(data.waterPressure)
            $('#pressure').html(data.pressure)
            $("#atmospherePress").html(data.atmospherePress)
            $('#faultType').html(data.faultType)
            $('#faultPosition').html(data.faultPosition)
            $('#applicationTime').html(data.applicationTime)
            $('#faultDesc').html(data.faultDesc)
            $('#attachmentName').html(data.attachmentName);
            $('#attachmentName').attr("data-id",data.attachmentId);
            $(".total").removeClass("active");
            $('#equipNo').html(undefind_nullStr(data.equipNo));
            $('#equipTypeName').html(undefind_nullStr(data.equipTypeName));
            $('#equipName').html(undefind_nullStr(data.equipName));
           // $('#equipStatuasId').html(undefind_nullStr(data.equipStatuasId));
            $('#equipTypeId').html(undefind_nullStr(data.equipTypeId));
            $('#modelNo').html(undefind_nullStr(data.modelNo));
            $('#spec').html(undefind_nullStr(data.spec));
            if(data.repairStatus==1){
                $('#equipStatuasCode').html(undefind_nullStr('报修中'))
            }else if(data.repairStatus==2){
                $('#equipStatuasCode').html(undefind_nullStr('维修中'))
            }else if(data.repairStatus==3){
                $('#equipStatuasCode').html(undefind_nullStr('验证中'))
            }else if(data.repairStatus==0){
                $('#equipStatuasCode').html(undefind_nullStr('已完成'))
            }


            $('#manufacturer').html(undefind_nullStr(data.manufacturer));
            $('#supplier').html(undefind_nullStr(data.supplier));
            //$('#positionId').html(undefind_nullStr(data.positionId));
            $('#factoryNo').html(undefind_nullStr(data.factoryNo));
            $('#borrowerdeptName').html(undefind_nullStr(data.deptName));
            $('#waterTemp').html(undefind_nullStr(data.waterTemp))
            $('#dateProduc').html(undefind_nullStr(format(data.dateProduc)));
            $('#recordDate').html(undefind_nullStr(format(data.recordDate)));
            $('#sourceAssets').html(undefind_nullStr(data.sourceAssets));
            $('#assetsCost').html(undefind_nullStr(data.assetsCost));
           // $('#propertyId').html(undefind_nullStr(data.propertyId));
            $('#accountFile').html(undefind_nullStr(data.accountFile));
            $('#sensitivityX').html(undefind_nullStr(data.sensitivityX));
            $('#sensitivityY').html(undefind_nullStr(data.sensitivityY));
            $('#sensitivityZ').html(undefind_nullStr(data.sensitivityZ));
            $('#phyQuantiId').html(undefind_nullStr(data.phyQuantiId));
            $('#directionId').html(undefind_nullStr(data.directionId));
            $('#couplingId').html(undefind_nullStr(data.couplingId));
            $('#cloudSn').html(undefind_nullStr(data.cloudSn));
            $('#custodian').html(undefind_nullStr(data.custodian));
            $('#standMateYn').html(undefind_nullStr(data.standMateYn));
            $('#technicalParm').html(undefind_nullStr(data.technicalParm));
            $('#memo').html(undefind_nullStr(data.memo));
            $('#deptId').html(undefind_nullStr(data.deptId));
            $('#deptName').html(undefind_nullStr(data.deptName));
            $('#attachmentName').html(data.attachmentName);
            $('#attachmentName').attr("data-id",data.attachmentId);
            //维修结果
            $('.inResult').val(undefind_nullStr(data.inResult));
            $('.outResult').val(undefind_nullStr(data.outResult));
            $('.inFaultPosition').val(undefind_nullStr(data.inFaultPosition));
            $('.outFaultPosition').val(undefind_nullStr(data.outFaultPosition));
            $('.inReason').val(undefind_nullStr(data.inReason));
            $('.outReason').val(undefind_nullStr(data.outReason));
            $('#inRepairMeasure').val(undefind_nullStr(data.inRepairMeasure));
            $('.outRepairMeasure').val(undefind_nullStr(data.outRepairMeasure));
            $('#outinR').val(undefind_nullStr(data.outinR));
            $(".grade").val(undefind_nullStr(data.grade));
            $('.outRepairRank').val(undefind_nullStr(data.outRepairRank));
            $('.inRepairRank').val(undefind_nullStr(data.inRepairRank));
            $(".inPrice").val(undefind_nullStr(data.inPrice));
            $('.outPrice').val(undefind_nullStr(data.outPrice));
            $('.inRepairMode').val(undefind_nullStr(data.inRepairMode));
            $('.outRepairMode').val(undefind_nullStr(data.outRepairMode));
            //验证结果
            $(".verifyMeasure").html(undefind_nullStr(data.verifyMeasure))
            $(".equipVerifyMode").html(undefind_nullStr(data.equipVerifyMode))
            $(".equipRepairResult").html(undefind_nullStr(data.equipRepairResult))
            $(".reportDoneTime").html(undefind_nullStr(data.reportDoneTime))
            $(".verifyUser").html(undefind_nullStr(data.verifyUser))
            $(".inPlanTime").val(undefind_nullStr(data.inPlanTime))
            $(".outPlanTime").val(undefind_nullStr(data.outPlanTime))
            $(".inPerson").val(undefind_nullStr(data.inPerson))
            $(".outPerson").val(undefind_nullStr(data.outPerson))
         }

    }
    //子调父关闭弹框方法
    function close() {
        tableObj.reload()
        layer.closeAll();
    }
    function closeend(){
        layer.closeAll();
    }

    function lookFile(repalogId){ //查看附件
        if (repalogId == undefined || repalogId == "") {
            layer.msg("文件已被损坏，无法查看");
        } else {
            selectFile(repalogId,'equipment');
        }
    }
    function downFile(repalogId){//下载附件
        if (repalogId == undefined || repalogId == "") {
            layer.msg("文件已被损坏，无法下载");
        } else {
            window.location.href = "/equipment/limsDownload?model=equipment&attachId=" +repalogId
        }
    }

    //刪除页数最后一条数据自动返回上一页
    function publicDeleteEval(url,ids,tableIns,table){
        layer.confirm('确定要删除吗?', {icon: 3, title:'提示'}, function(index){
            var data={
                repalogId:ids
            }
            var res=toAjaxT(url,data);
            layer.msg(res.msg)
            if(res.code==0){
                try {
                    if (ids.substring(ids.length - 1) == ",") {
                        ids = ids.substring(0, ids.length - 1);
                    }
                    var dataSize = ids.split(",");
                    var dataAll = table.cache[tableIns.config.id];
                    if (dataAll.length == dataSize.length) {
                        //得到当前页
                        var page = $(".layui-laypage-skip .layui-input").val();

                        if (page > 1) {
                            tableIns.reload({
                                page: {
                                    curr: page - 1 //重新从第 1 页开始
                                }}
                            );
                        }else{
                            tableIns=tableIns.reload();
                        }
                    } else {
                        tableIns=tableIns.reload();
                    }
                } catch (e) {
                    tableIns.reload();
                }
            }
            layer.close(index);
        });
    }
    //同步
    function toAjaxT(url,data) {
        var result;
        $.ajax({
            url:url,
            data:data,
            type: 'post',
            async:false,
            dataType: 'json',
            success: function (res){
                result=res;
            }
        });
        return result;
    }
</script>
<script>

</script>
</body>



</html>